//
//  MyBillViewController.m
//  PT
//
//  Created by jarze on 15/6/11.
//  Copyright (c) 2015年 jarze. All rights reserved.
//

#import "MyBillViewController.h"
#import "CTTableViewCell.h"
#import "MeItem.h"
#import "LabelItem.h"

@interface MyBillViewController ()

@end

@implementation MyBillViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addGroup];
}


- (void)addGroup
{
    
    LabelItem *item = [[LabelItem alloc] initWithIcon:@"Image" title:@"casnvdfjsn" subTitle:@"8.5分" label:@"dsvbcv vgds"];
    LabelItem *item1 = [[LabelItem alloc] initWithIcon:@"Image1" title:nil subTitle:@"8.5分" label:@"dsvgds"];
    LabelItem *item2 = [[LabelItem alloc] initWithIcon:@"Image2" title:@"casnvdfjsn" subTitle:nil label:@"ghbfgnds"];
    LabelItem *item3 = [[LabelItem alloc] initWithIcon:nil title:@"casnvdfjsn" subTitle:@"8.5分" label:@"sgbdfbhs"];
    Group *group = [[Group alloc] init];
    [group.items addObjectsFromArray: @[item, item1, item2,item3]];
    
    [self.datas addObject:group];
    
    LabelItem *item4 = [[LabelItem alloc] initWithIcon:@"Image" title:@"casnvdfjsn" subTitle:@"8.5分" label:@"dsvbcv vgds"];
    LabelItem *item14 = [[LabelItem alloc] initWithIcon:@"Image1" title:nil subTitle:@"8.5分" label:@"dsvgds"];
    LabelItem *item24 = [[LabelItem alloc] initWithIcon:@"Image2" title:@"casnvdfjsn" subTitle:nil label:@"ghbfgnds"];
    LabelItem *item34 = [[LabelItem alloc] initWithIcon:nil title:@"casnvdfjsn" subTitle:@"8.5分" label:@"sgbdfbhs"];
    Group *group1 = [[Group alloc] init];
    [group.items addObjectsFromArray: @[item4, item14, item24,item34]];
    [self.datas addObject:group1];

    
    
    
}
- (id)init
{
    return [super initWithStyle:UITableViewStyleGrouped];
    
    
}
- (id)initWithStyle:(UITableViewStyle)style
{
    return [super initWithStyle:UITableViewStyleGrouped];
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.1;
    
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 80;
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    CTTableViewCell *cell = [CTTableViewCell cellWithTableView:self.tableView];
    Group *g = self.datas[indexPath.section];
    
    //  从组模型中取出对应行的模型
    LabelItem *item = g.items[indexPath.row];
    cell.LabelItem = item;
    
    cell.LabelItem = g.items[indexPath.row];
    return cell;
}

@end
